/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.celiosilva.simbanc.controller.cliente;

import com.celiosilva.simbanc.business.ClienteBusiness;
import com.celiosilva.simbanc.business.seguranca.Permissao;
import com.celiosilva.simbanc.business.util.Sucesso;
import com.celiosilva.simbanc.controller.util.Conversor;
import com.celiosilva.simbanc.exceptions.AcessoNegadoException;
import com.celiosilva.simbanc.exceptions.SimbancException;

/**
 *
 * @author celio@celiosilva.com
 */
public class ReativarClienteController extends VisualizarClienteController{

    public ReativarClienteController(Integer codcliente) throws AcessoNegadoException {
        super(codcliente);
    }

    public ReativarClienteController() throws AcessoNegadoException {}
    
    @Override
    protected String getTitulo() {
        return "Reativar Cliente";
    }

    @Override
    protected void reativarCliente() {
        try {
            Integer codCliente = (Integer) Conversor.STRING_INTEGER.converterPara(this.txtCodigo.getText());
            Sucesso s = ClienteBusiness.getInstance().reativarCliente(codCliente);
            this.mostrarAviso(s);
        } catch (SimbancException ex) {
            this.mostrarAviso(ex);
        }
    }

    @Override
    public Permissao getPermissaoAtribuida() {
        return Permissao.REATIVAR_CLIENTE;
    }







}
